<?php


class irclogger extends module
{

	public $title = "Irc Logger";
	public $author = "Hery";
	public $version = "0.9.0";
	

	public function func_write($line, $args)
	{
		switch($line['cmd'])
		{
			case 'MODE':
				$line['chan'] = $line['to'];
				$line['text'] = $line['params'];
			break;
			case 'QUIT':
				$line['chan'] = '';
			break;
			case 'PART':
				$line['chan'] = $line['to'];
			case 'JOIN':
				$line['chan'] = $line['text'];
			break;
			case 'KICK':
				$line['chan'] = $line['to'];
				$line['to'] = $line['params'];
			break;
			default:
				if(substr($line['params'], 0, 8) == ':ACTION')
				{
					$line['cmd'] = "ACTION";
					$line['text'] = str_replace('ACTION', '', $line['text']);
				}
				$line['chan'] = $line['to'];
			break;
			
		}
		
		$values = array($line['fromNick'], $line['text'], $line['from'], $line['to'], $line['chan']);
		
		$this->db->query("INSERT INTO ci_karajia_archives (`user`, `type`, `msg`, `userhost`, `to`, `chan`, `dt`) VALUES ('[1]', '$line[cmd]', '[2]', '[3]', '[4]', '[5]', '" . time() . "')", $values);

	}
}

?>
